/**
* 
* Copyright [2007] [Sunny Liu]
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*/

package ${appConfig.outputPackageName}.dao;

import java.util.List;

import ${appConfig.outputPackageName}.model.${entity.javaName};


public interface ${entity.javaName}DAO
{
	/**
	* this is a default find method for DAO, it will list all table contents
	* or limited by query.
	*/
	public List findAll${entity.javaName}();
	
	<#if entity.hasPrimaryKey >	
	/**
	* Find domain model object from underline table base upon
	* primary key.
	*/	
	public ${entity.javaName} find${entity.javaName}ByKey(<#list entity.primaryKeyColumns as attribute>${attribute.javaType} ${attribute.javaName} <#if attribute_has_next>, </#if></#list>);
	
	public ${entity.javaName} find${entity.javaName}ByKey(${entity.javaName} ${entity.normalizedJavaName});
	
	</#if>
	
	/**
	* Insert a domain model into underline table.
	*/
	public ${entity.javaName} add${entity.javaName}(${entity.javaName} model);
	
	/**
	* This method update underline row in relational database
	*/	
	public ${entity.javaName} update${entity.javaName}(${entity.javaName} model);
	
	/**
	* This method delete underline row from relational database
	*/
	public ${entity.javaName} delete${entity.javaName}(${entity.javaName} model);
	
	<#if entity.hasPrimaryKey >		
	/**
	* This method delete underline row from relational database
	* with model's primary key.
	*/	
	public ${entity.javaName} delete${entity.javaName}ByKey(<#list entity.primaryKeyColumns as attribute>${attribute.javaType} ${attribute.javaName} <#if attribute_has_next>, </#if></#list>);
	</#if>
}